<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>class RubyXL::OOXMLRelationshipsFile - rubyXL 3.4.35</title>


  <meta name="keywords" content="ruby,class,RubyXL::OOXMLRelationshipsFile">


    <meta name="description" content="Documentation for the RubyXL::OOXMLRelationshipsFile class">





<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
</script>

<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<link href="../css/fonts.css" rel="stylesheet">
<link href="../css/rdoc.css" rel="stylesheet">



<body id="top" role="document" class="class">
<div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
  <span aria-hidden="true">&#9776;</span>
</div>


<nav id="navigation" role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  

  
<div id="parent-class-section" class="nav-section">
  <h3>Ancestors</h3>
  <ul><li><a href="OOXMLTopLevelObject.html">RubyXL::OOXMLTopLevelObject</a><ul><li><a href="OOXMLObject.html">RubyXL::OOXMLObject</a><ul><li>Object</li></ul></li></ul></li></ul>
</div>


  

  

  
  <div class="nav-section">
    <h3>Class Methods</h3>
    <ul class="link-list" role="directory">

      <li ><a href="#method-c-get_class_by_rel_type">get_class_by_rel_type</a></li>

      <li ><a href="#method-c-load_relationship_file">load_relationship_file</a></li>

      <li ><a href="#method-c-rel_file_path">rel_file_path</a></li>

    </ul>
  </div>



  <div class="nav-section">
    <h3>Instance Methods</h3>
    <ul class="link-list" role="directory">

      <li ><a href="#method-i-add_relationship">add_relationship</a></li>

      <li class="calls-super" ><a href="#method-i-before_write_xml">before_write_xml</a></li>

      <li ><a href="#method-i-find_by_rid">find_by_rid</a></li>

      <li ><a href="#method-i-find_by_target">find_by_target</a></li>

      <li ><a href="#method-i-load_related_files">load_related_files</a></li>

      <li ><a href="#method-i-new_relationship">new_relationship</a></li>

      <li ><a href="#method-i-xlsx_path">xlsx_path</a></li>

    </ul>
  </div>



  <footer id="validator-badges" role="contentinfo">
  <p><a href="https://validator.w3.org/check/referer">Validate</a></p>
  <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.15.1.</p>
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>
</footer>

</nav>

<main role="main" aria-labelledby="class-RubyXL::OOXMLRelationshipsFile">
  
  
    <ol role="navigation" aria-label="Breadcrumb navigation" class="breadcrumb">
      
      <li>
        
        <a href="../RubyXL.html">RubyXL</a><span>::</span>
        
      </li>
      
      <li>
        
        <span>OOXMLRelationshipsFile</span>
        
      </li>
      
    </ol>
  

  <h1 id="class-RubyXL::OOXMLRelationshipsFile" class="anchor-link class">
    class RubyXL::OOXMLRelationshipsFile
  </h1>

  <section class="description">
    
  </section>


  <section id="5Buntitled-5D" class="documentation-section anchor-link">





    <section class="constants-list">
      <header>
        <h3>Constants</h3>
      </header>
      <dl>

        <dt id="CONTENT_TYPE">CONTENT_TYPE</dt>

        <dd>

          
        </dd>


        <dt id="SAVE_ORDER">SAVE_ORDER</dt>

        <dd>

          
        </dd>


      </dl>
    </section>



    <section class="attribute-method-details method-section">
      <header>
        <h3>Attributes</h3>
      </header>


      <div id="attribute-i-owner" class="method-detail anchor-link">
        <div class="method-heading attribute-method-heading">
          <a href="#attribute-i-owner" title="Link to this attribute">
            <span class="method-name">owner</span>
            <span class="attribute-access-type">[RW]</span>
          </a>
        </div>

        <div class="method-description">


        

        </div>
      </div>

      <div id="attribute-i-related_files" class="method-detail anchor-link">
        <div class="method-heading attribute-method-heading">
          <a href="#attribute-i-related_files" title="Link to this attribute">
            <span class="method-name">related_files</span>
            <span class="attribute-access-type">[RW]</span>
          </a>
        </div>

        <div class="method-description">


        

        </div>
      </div>

    </section>



     <section id="public-class-5Buntitled-5D-method-details" class="method-section anchor-link">
       <header>
         <h3>Public Class Methods</h3>
       </header>


      <div id="method-c-get_class_by_rel_type" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-c-get_class_by_rel_type" title="Link to this method">
                <span class="method-name">get_class_by_rel_type</span>
                <span class="method-args">(rel_type)</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="get_class_by_rel_type-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 55</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">get_class_by_rel_type</span>(<span class="ruby-identifier">rel_type</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-identifier">@@rel_hash</span>)
    <span class="ruby-identifier">@@rel_hash</span> = {}
    <span class="ruby-constant">RubyXL</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">klass</span> = <span class="ruby-constant">RubyXL</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">c</span>)

      <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Class</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-value">:REL_TYPE</span>) <span class="ruby-keyword">then</span>
        <span class="ruby-identifier">@@rel_hash</span>[<span class="ruby-identifier">klass</span><span class="ruby-operator">::</span><span class="ruby-constant">REL_TYPE</span>] = <span class="ruby-identifier">klass</span>
      <span class="ruby-keyword">end</span>
    }
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">@@rel_hash</span>[<span class="ruby-identifier">rel_type</span>]
<span class="ruby-keyword">end</span></pre>
          </div>



          


        </div>





      </div>


      <div id="method-c-load_relationship_file" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-c-load_relationship_file" title="Link to this method">
                <span class="method-name">load_relationship_file</span>
                <span class="method-args">(zipdir_path, base_file_path)</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="load_relationship_file-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 103</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">load_relationship_file</span>(<span class="ruby-identifier">zipdir_path</span>, <span class="ruby-identifier">base_file_path</span>)
  <span class="ruby-identifier">rel_file_path</span> = <span class="ruby-identifier">rel_file_path</span>(<span class="ruby-identifier">base_file_path</span>)

  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;--&gt; DEBUG:  #{&#39;  &#39; * @@debug_indent}Loading .rel file: #{rel_file_path}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">@@debug_indent</span>

  <span class="ruby-identifier">parse_file</span>(<span class="ruby-identifier">zipdir_path</span>, <span class="ruby-identifier">rel_file_path</span>)
<span class="ruby-keyword">end</span></pre>
          </div>



          


        </div>





      </div>


      <div id="method-c-rel_file_path" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-c-rel_file_path" title="Link to this method">
                <span class="method-name">rel_file_path</span>
                <span class="method-args">(base_file_path)</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="rel_file_path-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 129</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">rel_file_path</span>(<span class="ruby-identifier">base_file_path</span>)
  <span class="ruby-identifier">basename</span> = <span class="ruby-identifier">base_file_path</span>.<span class="ruby-identifier">root?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&#39;&#39;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">base_file_path</span>.<span class="ruby-identifier">basename</span>
  <span class="ruby-identifier">base_file_path</span>.<span class="ruby-identifier">dirname</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;_rels&#39;</span>, <span class="ruby-node">&quot;#{basename}.rels&quot;</span>).<span class="ruby-identifier">cleanpath</span>
<span class="ruby-keyword">end</span></pre>
          </div>



          


        </div>





      </div>


    </section>

     <section id="public-instance-5Buntitled-5D-method-details" class="method-section anchor-link">
       <header>
         <h3>Public Instance Methods</h3>
       </header>


      <div id="method-i-before_write_xml" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-i-before_write_xml" title="Link to this method">
                <span class="method-name">before_write_xml</span>
                <span class="method-args">()</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="before_write_xml-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 115</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">before_write_xml</span>
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">owner</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">WorkbookRoot</span>, <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Workbook</span> <span class="ruby-keyword">then</span>
    <span class="ruby-comment"># Fully implemented objects with no generic (unhandled) relationships -</span>
    <span class="ruby-comment">#   (re)generating relationships from scratch.</span>
    <span class="ruby-identifier">related_objects</span> = <span class="ruby-identifier">owner</span>.<span class="ruby-identifier">related_objects</span>
    <span class="ruby-identifier">related_objects</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">owner</span>.<span class="ruby-identifier">generic_storage</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">owner</span>.<span class="ruby-identifier">generic_storage</span>

    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">relationships</span> = []
    <span class="ruby-identifier">related_objects</span>.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">add_relationship</span>(<span class="ruby-identifier">f</span>) }
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">super</span>
<span class="ruby-keyword">end</span></pre>
          </div>



          


            <div class="method-calls-super">
              Calls superclass method
              <a href="OOXMLObjectInstanceMethods.html#method-i-before_write_xml"><code>RubyXL::OOXMLObjectInstanceMethods#before_write_xml</code></a>
            </div>

        </div>





      </div>


      <div id="method-i-find_by_rid" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-i-find_by_rid" title="Link to this method">
                <span class="method-name">find_by_rid</span>
                <span class="method-args">(r_id)</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="find_by_rid-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 45</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">find_by_rid</span>(<span class="ruby-identifier">r_id</span>)
  <span class="ruby-identifier">relationships</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">r_id</span> }
<span class="ruby-keyword">end</span></pre>
          </div>



          


        </div>





      </div>


      <div id="method-i-find_by_target" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-i-find_by_target" title="Link to this method">
                <span class="method-name">find_by_target</span>
                <span class="method-args">(target)</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="find_by_target-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 49</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">find_by_target</span>(<span class="ruby-identifier">target</span>)
  <span class="ruby-identifier">relationships</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
    (<span class="ruby-identifier">r</span>.<span class="ruby-identifier">target</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">target</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">r</span>.<span class="ruby-identifier">target</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">relative_path_from</span>(<span class="ruby-identifier">owner</span>.<span class="ruby-identifier">xlsx_path</span>.<span class="ruby-identifier">dirname</span>))
  }
<span class="ruby-keyword">end</span></pre>
          </div>



          


        </div>





      </div>


      <div id="method-i-load_related_files" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-i-load_related_files" title="Link to this method">
                <span class="method-name">load_related_files</span>
                <span class="method-args">(zipdir_path, base_file_name)</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="load_related_files-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 70</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">load_related_files</span>(<span class="ruby-identifier">zipdir_path</span>, <span class="ruby-identifier">base_file_name</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">related_files</span> = {}

  <span class="ruby-identifier">@@debug_indent</span> <span class="ruby-operator">+=</span> <span class="ruby-value">2</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">@@debug_indent</span>

  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">relationships</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">rel</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rel</span>.<span class="ruby-identifier">target_mode</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;External&#39;</span>

    <span class="ruby-identifier">file_path</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rel</span>.<span class="ruby-identifier">target</span>)
    <span class="ruby-identifier">file_path</span> = (<span class="ruby-identifier">base_file_name</span>.<span class="ruby-identifier">dirname</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">file_path</span>).<span class="ruby-identifier">cleanpath</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">file_path</span>.<span class="ruby-identifier">relative?</span>

    <span class="ruby-identifier">klass</span> = <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">OOXMLRelationshipsFile</span>.<span class="ruby-identifier">get_class_by_rel_type</span>(<span class="ruby-identifier">rel</span>.<span class="ruby-identifier">type</span>)

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">then</span>
      <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">RubyXL</span>.<span class="ruby-identifier">class_variable_get</span>(<span class="ruby-value">:@@suppress_warnings</span>) <span class="ruby-keyword">then</span>
        <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;*** WARNING: storage class not found for #{rel.target} (#{rel.type})&quot;</span>
      <span class="ruby-keyword">end</span>

      <span class="ruby-identifier">klass</span> = <span class="ruby-constant">GenericStorageObject</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;--&gt; DEBUG:#{&#39;  &#39; * @@debug_indent}Loading #{klass} (#{rel.id}): #{file_path}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">@@debug_indent</span>

    <span class="ruby-identifier">obj</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">parse_file</span>(<span class="ruby-identifier">zipdir_path</span>, <span class="ruby-identifier">file_path</span>)
    <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">load_relationships</span>(<span class="ruby-identifier">zipdir_path</span>, <span class="ruby-identifier">file_path</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:load_relationships</span>)
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">related_files</span>[<span class="ruby-identifier">rel</span>.<span class="ruby-identifier">id</span>] = <span class="ruby-identifier">obj</span>
  }

  <span class="ruby-identifier">@@debug_indent</span> <span class="ruby-operator">-=</span> <span class="ruby-value">2</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">@@debug_indent</span>

  <span class="ruby-identifier">related_files</span>
<span class="ruby-keyword">end</span></pre>
          </div>



          


        </div>





      </div>


      <div id="method-i-xlsx_path" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-i-xlsx_path" title="Link to this method">
                <span class="method-name">xlsx_path</span>
                <span class="method-args">()</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="xlsx_path-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 111</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">xlsx_path</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">rel_file_path</span>(<span class="ruby-identifier">owner</span>.<span class="ruby-identifier">xlsx_path</span>)
<span class="ruby-keyword">end</span></pre>
          </div>



          


        </div>





      </div>


    </section>

     <section id="protected-instance-5Buntitled-5D-method-details" class="method-section anchor-link">
       <header>
         <h3>Protected Instance Methods</h3>
       </header>


      <div id="method-i-add_relationship" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-i-add_relationship" title="Link to this method">
                <span class="method-name">add_relationship</span>
                <span class="method-args">(obj)</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="add_relationship-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_relationship</span>(<span class="ruby-identifier">obj</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-keyword">defined?</span>(<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">REL_TYPE</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:empty?</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">empty?</span>)

  <span class="ruby-identifier">relationships</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Relationship</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:id</span>     <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;rId#{relationships.size + 1}&quot;</span>,
                                            <span class="ruby-value">:type</span>   <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">REL_TYPE</span>,
                                            <span class="ruby-value">:target</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">xlsx_path</span>.<span class="ruby-identifier">relative_path_from</span>(<span class="ruby-identifier">owner</span>.<span class="ruby-identifier">xlsx_path</span>.<span class="ruby-identifier">dirname</span>))
<span class="ruby-keyword">end</span></pre>
          </div>



          


        </div>





      </div>


      <div id="method-i-new_relationship" class="method-detail anchor-link ">
        <div class="method-header">

            <div class="method-heading">
              <a href="#method-i-new_relationship" title="Link to this method">
                <span class="method-name">new_relationship</span>
                <span class="method-args">(target, type)</span>
              </a>
            </div>

        </div>


          <div class="method-controls">
            <details class="method-source-toggle">
              <summary>Source</summary>
            </details>
          </div>



        <div class="method-description">

          <div class="method-source-code" id="new_relationship-source">
            <pre><span class="ruby-comment"># File lib/rubyXL/objects/relationships.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">new_relationship</span>(<span class="ruby-identifier">target</span>, <span class="ruby-identifier">type</span>)
  <span class="ruby-constant">RubyXL</span><span class="ruby-operator">::</span><span class="ruby-constant">Relationship</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:id</span>     <span class="ruby-operator">=&gt;</span> <span class="ruby-node">&quot;rId#{relationships.size + 1}&quot;</span>,
                           <span class="ruby-value">:type</span>   <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">type</span>,
                           <span class="ruby-value">:target</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">target</span>)
<span class="ruby-keyword">end</span></pre>
          </div>



          


        </div>





      </div>


    </section>

  </section>

</main>
</body>

